//
//  BankViewController.m
//  CocoaSynth
//
//  Created by Thomas Dupont on 18/02/10.
//  Copyright 2010 Apple Inc. All rights reserved.
//

#import "BankViewController.h"

#import "BankVCOViewController.h"
#import "BankVCFViewController.h"
#import "BankVCAViewController.h"
#import "BankADSRViewController.h"
#import "BankSpeakerViewController.h"
#import "BankDispatcherViewController.h"
#import "BankKeyboardViewController.h"
#import "BankWriterViewController.h"
#import "BankView.h"

#define BANKHEIGHT 84
#define ESPACEMENT 21

@implementation BankViewController

- (void)awakeFromNib
{
	int x = ESPACEMENT;
	
	BankVCOViewController* vcoController = [[BankVCOViewController alloc] init];
	BankView* vcoView = [vcoController view];
	[vcoView setFrameOrigin:NSMakePoint(x, (BANKHEIGHT - vcoView.frame.size.height) / 2)];
	
	x += vcoView.frame.size.width + ESPACEMENT;
	
	BankVCFViewController* vcfController = [[BankVCFViewController alloc] init];
	BankView* vcfView = [vcfController view];
	[vcfView setFrameOrigin:NSMakePoint(x, (BANKHEIGHT - vcfView.frame.size.height) / 2)];
	
	x += vcfView.frame.size.width + ESPACEMENT;
	
	BankVCAViewController* vcaController = [[BankVCAViewController alloc] init];
	BankView* vcaView = [vcaController view];
	[vcaView setFrameOrigin:NSMakePoint(x, (BANKHEIGHT - vcaView.frame.size.height) / 2)];
	
	x += vcaView.frame.size.width + ESPACEMENT;
	
	BankADSRViewController* adsrController = [[BankADSRViewController alloc] init];
	BankView* adsrView = [adsrController view];
	[adsrView setFrameOrigin:NSMakePoint(x, (BANKHEIGHT - adsrView.frame.size.height) / 2)];
	
	x += adsrView.frame.size.width + ESPACEMENT;
	
	BankDispatcherViewController* dispatcherController = [[BankDispatcherViewController alloc] init];
	BankView* dispatcherView = [dispatcherController view];
	[dispatcherView setFrameOrigin:NSMakePoint(x, (BANKHEIGHT - dispatcherView.frame.size.height) / 2)];
	
	x += dispatcherView.frame.size.width + ESPACEMENT;
	
	BankKeyboardViewController* keyboardController = [[BankKeyboardViewController alloc] init];
	BankView* keyboardView = [keyboardController view];
	[keyboardView setFrameOrigin:NSMakePoint(x, (BANKHEIGHT - keyboardView.frame.size.height) / 2)];
	
	x += keyboardView.frame.size.width + ESPACEMENT;
	
	BankWriterViewController* writerController = [[BankWriterViewController alloc] init];
	BankView* writerView = [writerController view];
	[writerView setFrameOrigin:NSMakePoint(x, (BANKHEIGHT - writerView.frame.size.height) / 2)];
	
	x += writerView.frame.size.width + ESPACEMENT;
	
	BankSpeakerViewController* speakerController = [[BankSpeakerViewController alloc] init];
	BankView* speakerView = [speakerController view];
	[speakerView setFrameOrigin:NSMakePoint(x, (BANKHEIGHT - speakerView.frame.size.height) / 2)];
	
	x += speakerView.frame.size.width + ESPACEMENT;
	
	[self.view addSubview:vcoView];
	[self.view addSubview:vcfView];
	[self.view addSubview:vcaView];
	[self.view addSubview:adsrView];
	[self.view addSubview:dispatcherView];
	[self.view addSubview:keyboardView];
	[self.view addSubview:writerView];
	[self.view addSubview:speakerView];
}

@end
